﻿
namespace ATA.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.DaiLy"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class DaiLyEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the DaiLyId property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxDaiLyId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the DaiLyId property.
		/// </summary>
		protected System.Windows.Forms.Label uxDaiLyIdLabel;
		
		/// <summary>
		/// TextBox for the TenDaiLy property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxTenDaiLy;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the TenDaiLy property.
		/// </summary>
		protected System.Windows.Forms.Label uxTenDaiLyLabel;
		
		/// <summary>
		/// ComboBox for the LoaiDaiLyId property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxLoaiDaiLyId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the LoaiDaiLyId property.
		/// </summary>
		protected System.Windows.Forms.Label uxLoaiDaiLyIdLabel;
		
		/// <summary>
		/// TextBox for the ParentId property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxParentId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ParentId property.
		/// </summary>
		protected System.Windows.Forms.Label uxParentIdLabel;
		
		/// <summary>
		/// DataTimePicker for the LastUpdate property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxLastUpdate;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the LastUpdate property.
		/// </summary>
		protected System.Windows.Forms.Label uxLastUpdateLabel;
		
		/// <summary>
		/// TextBox for the UpdateBy property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxUpdateBy;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the UpdateBy property.
		/// </summary>
		protected System.Windows.Forms.Label uxUpdateByLabel;
		
		/// <summary>
		/// CheckBox for the IsActive property.
		/// </summary>
		protected System.Windows.Forms.CheckBox uxIsActive;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IsActive property.
		/// </summary>
		protected System.Windows.Forms.Label uxIsActiveLabel;
		#endregion
		
		#region Main entity
		private Entities.DaiLy _DaiLy;
		/// <summary>
		/// Gets or sets the <see cref="Entities.DaiLy"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.DaiLy"/> instance.</value>
		public Entities.DaiLy DaiLy
		{
			get {return this._DaiLy;}
			set
			{
				this._DaiLy = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxDaiLyId.DataBindings.Clear();
			this.uxDaiLyId.DataBindings.Add("Text", this.uxBindingSource, "DaiLyId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxTenDaiLy.DataBindings.Clear();
			this.uxTenDaiLy.DataBindings.Add("Text", this.uxBindingSource, "TenDaiLy", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLoaiDaiLyId.DataBindings.Clear();
			this.uxLoaiDaiLyId.DataBindings.Add("SelectedValue", this.uxBindingSource, "LoaiDaiLyId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxParentId.DataBindings.Clear();
			this.uxParentId.DataBindings.Add("Text", this.uxBindingSource, "ParentId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLastUpdate.DataBindings.Clear();
			this.uxLastUpdate.DataBindings.Add("Value", this.uxBindingSource, "LastUpdate", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxUpdateBy.DataBindings.Clear();
			this.uxUpdateBy.DataBindings.Add("Text", this.uxBindingSource, "UpdateBy", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIsActive.DataBindings.Clear();
			this.uxIsActive.DataBindings.Add("Checked", this.uxBindingSource, "IsActive", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="DaiLyEditControlBase"/> class.
		/// </summary>
		public DaiLyEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_DaiLy != null) _DaiLy.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxDaiLyId = new System.Windows.Forms.TextBox();
			uxDaiLyIdLabel = new System.Windows.Forms.Label();
			this.uxTenDaiLy = new System.Windows.Forms.TextBox();
			uxTenDaiLyLabel = new System.Windows.Forms.Label();
			this.uxLoaiDaiLyId = new System.Windows.Forms.ComboBox();
			uxLoaiDaiLyIdLabel = new System.Windows.Forms.Label();
			this.uxParentId = new System.Windows.Forms.TextBox();
			uxParentIdLabel = new System.Windows.Forms.Label();
			this.uxLastUpdate = new System.Windows.Forms.DateTimePicker();
			uxLastUpdateLabel = new System.Windows.Forms.Label();
			this.uxUpdateBy = new System.Windows.Forms.TextBox();
			uxUpdateByLabel = new System.Windows.Forms.Label();
			this.uxIsActive = new System.Windows.Forms.CheckBox();
			uxIsActiveLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxDaiLyIdLabel
			//
			this.uxDaiLyIdLabel.Name = "uxDaiLyIdLabel";
			this.uxDaiLyIdLabel.Text = "Dai Ly Id:";
			this.uxDaiLyIdLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxDaiLyIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDaiLyIdLabel);			
			//
			// uxDaiLyId
			//
			this.uxDaiLyId.Name = "uxDaiLyId";
            this.uxDaiLyId.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxDaiLyId);
			this.uxDaiLyId.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxDaiLyId);
			//
			// uxTenDaiLyLabel
			//
			this.uxTenDaiLyLabel.Name = "uxTenDaiLyLabel";
			this.uxTenDaiLyLabel.Text = "Ten Dai Ly:";
			this.uxTenDaiLyLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxTenDaiLyLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxTenDaiLyLabel);			
			//
			// uxTenDaiLy
			//
			this.uxTenDaiLy.Name = "uxTenDaiLy";
			this.uxTenDaiLy.Width = 250;
			this.uxTenDaiLy.MaxLength = 100;
			//this.uxTableLayoutPanel.Controls.Add(this.uxTenDaiLy);
			this.uxTenDaiLy.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxTenDaiLy);
			//
			// uxLoaiDaiLyIdLabel
			//
			this.uxLoaiDaiLyIdLabel.Name = "uxLoaiDaiLyIdLabel";
			this.uxLoaiDaiLyIdLabel.Text = "Loai Dai Ly Id:";
			this.uxLoaiDaiLyIdLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxLoaiDaiLyIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLoaiDaiLyIdLabel);			
			//
			// uxLoaiDaiLyId
			//
			this.uxLoaiDaiLyId.Name = "uxLoaiDaiLyId";
			//this.uxTableLayoutPanel.Controls.Add(this.uxLoaiDaiLyId);
			this.uxLoaiDaiLyId.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxLoaiDaiLyId);
			//
			// uxParentIdLabel
			//
			this.uxParentIdLabel.Name = "uxParentIdLabel";
			this.uxParentIdLabel.Text = "Parent Id:";
			this.uxParentIdLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxParentIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxParentIdLabel);			
			//
			// uxParentId
			//
			this.uxParentId.Name = "uxParentId";
			//this.uxTableLayoutPanel.Controls.Add(this.uxParentId);
			this.uxParentId.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxParentId);
			//
			// uxLastUpdateLabel
			//
			this.uxLastUpdateLabel.Name = "uxLastUpdateLabel";
			this.uxLastUpdateLabel.Text = "Last Update:";
			this.uxLastUpdateLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxLastUpdateLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLastUpdateLabel);			
			//
			// uxLastUpdate
			//
			this.uxLastUpdate.Name = "uxLastUpdate";
			//this.uxTableLayoutPanel.Controls.Add(this.uxLastUpdate);
			this.uxLastUpdate.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxLastUpdate);
			//
			// uxUpdateByLabel
			//
			this.uxUpdateByLabel.Name = "uxUpdateByLabel";
			this.uxUpdateByLabel.Text = "Update By:";
			this.uxUpdateByLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxUpdateByLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxUpdateByLabel);			
			//
			// uxUpdateBy
			//
			this.uxUpdateBy.Name = "uxUpdateBy";
			//this.uxTableLayoutPanel.Controls.Add(this.uxUpdateBy);
			this.uxUpdateBy.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxUpdateBy);
			//
			// uxIsActiveLabel
			//
			this.uxIsActiveLabel.Name = "uxIsActiveLabel";
			this.uxIsActiveLabel.Text = "Is Active:";
			this.uxIsActiveLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxIsActiveLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIsActiveLabel);			
			//
			// uxIsActive
			//
			this.uxIsActive.Name = "uxIsActive";
			//this.uxTableLayoutPanel.Controls.Add(this.uxIsActive);
			this.uxIsActive.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxIsActive);
			//
			// uxLoaiDaiLyId
			//				
			this.uxLoaiDaiLyId.DisplayMember = "TenLoaiKhachHang";	
			this.uxLoaiDaiLyId.ValueMember = "LoaiKhachHangId";	
			// 
			// DaiLyEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "DaiLyEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.LoaiKhachHang> _LoaiDaiLyIdList;
		
		/// <summary>
		/// The ComboBox associated with the LoaiDaiLyId property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.LoaiKhachHang> LoaiDaiLyIdList
		{
			get {return _LoaiDaiLyIdList;}
			set 
			{
				this._LoaiDaiLyIdList = value;
				this.uxLoaiDaiLyId.DataSource = null;
				this.uxLoaiDaiLyId.DataSource = value;
			}
		}
		
		private bool _allowNewItemInLoaiDaiLyIdList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the LoaiDaiLyId property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInLoaiDaiLyIdList
		{
			get { return _allowNewItemInLoaiDaiLyIdList;}
			set
			{
				this._allowNewItemInLoaiDaiLyIdList = value;
				this.uxLoaiDaiLyId.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
        #region Field visibility

        /// <summary>
        /// Indicates if the controls associated with the uxDaiLyId property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxDaiLyIdVisible
        {
            get { return this.uxDaiLyId.Visible; }
            set
            {
                this.uxDaiLyIdLabel.Visible = value;
                this.uxDaiLyId.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxDaiLyId property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxDaiLyIdEnabled
        {
            get { return this.uxDaiLyId.Enabled; }
            set
            {
                this.uxDaiLyId.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxTenDaiLy property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxTenDaiLyVisible
        {
            get { return this.uxTenDaiLy.Visible; }
            set
            {
                this.uxTenDaiLyLabel.Visible = value;
                this.uxTenDaiLy.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxTenDaiLy property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxTenDaiLyEnabled
        {
            get { return this.uxTenDaiLy.Enabled; }
            set
            {
                this.uxTenDaiLy.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxLoaiDaiLyId property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxLoaiDaiLyIdVisible
        {
            get { return this.uxLoaiDaiLyId.Visible; }
            set
            {
                this.uxLoaiDaiLyIdLabel.Visible = value;
                this.uxLoaiDaiLyId.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxLoaiDaiLyId property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxLoaiDaiLyIdEnabled
        {
            get { return this.uxLoaiDaiLyId.Enabled; }
            set
            {
                this.uxLoaiDaiLyId.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxParentId property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxParentIdVisible
        {
            get { return this.uxParentId.Visible; }
            set
            {
                this.uxParentIdLabel.Visible = value;
                this.uxParentId.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxParentId property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxParentIdEnabled
        {
            get { return this.uxParentId.Enabled; }
            set
            {
                this.uxParentId.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxLastUpdate property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxLastUpdateVisible
        {
            get { return this.uxLastUpdate.Visible; }
            set
            {
                this.uxLastUpdateLabel.Visible = value;
                this.uxLastUpdate.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxLastUpdate property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxLastUpdateEnabled
        {
            get { return this.uxLastUpdate.Enabled; }
            set
            {
                this.uxLastUpdate.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxUpdateBy property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxUpdateByVisible
        {
            get { return this.uxUpdateBy.Visible; }
            set
            {
                this.uxUpdateByLabel.Visible = value;
                this.uxUpdateBy.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxUpdateBy property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxUpdateByEnabled
        {
            get { return this.uxUpdateBy.Enabled; }
            set
            {
                this.uxUpdateBy.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxIsActive property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxIsActiveVisible
        {
            get { return this.uxIsActive.Visible; }
            set
            {
                this.uxIsActiveLabel.Visible = value;
                this.uxIsActive.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxIsActive property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxIsActiveEnabled
        {
            get { return this.uxIsActive.Enabled; }
            set
            {
                this.uxIsActive.Enabled = value;
            }
        }

        #endregion

		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
